package com.fifth.user.controller;

import com.fifth.common.pojo.dto.CommonResult;
import com.fifth.common.pojo.entity.Collection;
import com.fifth.user.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 第五组
 * @since 2022-09-02
 */
@RestController
@RequestMapping("user/collection")
public class CollectionController {
    @Autowired
    private CollectionService collectionService;
    //添加收藏信息
    @PostMapping("insertCollection")
    public CommonResult insertConllection(@RequestBody Collection collection){
        return collectionService.insertCollection(collection);
    }
    //删除收藏商品信息
    @PostMapping("deleteGid")
    public CommonResult deleteCollection(String goodsid){
        return collectionService.deleteCollection(goodsid);
    }
    //删除收藏店铺信息
    @PostMapping("deleteBid")
    public CommonResult deleteBid(String bid){
        return collectionService.deleteBid(bid);
    }
    //查询所有收藏商家信息
    @GetMapping("findBid")
    public CommonResult selectBid(){
        return collectionService.findBid();
    }
    //查询所有收藏商品信息
    @GetMapping("/findGid")
    public CommonResult selectGid(){
        return collectionService.findGid();
    }
    //根据店铺id查询该视频是否被收藏
    @GetMapping("findByBid")
    public CommonResult findByBid(String id){
        return collectionService.findByBid(id);
    }
    //根据商品id查询该商品是否被收藏
    @GetMapping("findByGoodsid")
    public CommonResult findByGoodsid(String id){
        return collectionService.findByGoodsid(id);
    }

}
